
export default {
  data() {
    return {
      currentTime: 0,
    };
  },
  methods: {
    // 试看
    vidoePreview(timelong, type, operator = 'previewEnd') {
      const timer = setInterval(() => {
        if (type === 'pol') {
          this.currentTime = this.player.j2s_getCurrentTime();
        } else {
          this.currentTime = this.player.getCurrentTime();
        }
        if (this.currentTime >= timelong) {
          // 暂停视频
          if (type === 'pol') {
            this.player.j2s_pauseVideo();
          } else {
            this.player.pause();
          }
          clearInterval(timer);
          this[operator]();
          // const playerShade = document.getElementById('playerShade');
          // playerShade.style.display = 'flex';
          // playerShade.style.alignItems = 'center';
          // playerShade.style.justifyContent = 'center';
          // const htm = '试看已结束，
          // 请<a style="color: #ffb750;padding: 0 10px;cursor: pointer; ">登录</a>或
          // <a style="color: #ffb750;padding: 0 10px;cursor: pointer; ">购买</a>该视频';
          // playerShade.innerHTML = htm;
        }
      }, 500);
    },
  },
};
